home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / FREENET / DEVOS / FDSOURCE.ARC / h / menu < prev    next >
Text File  |  1996-03-11  |  3KB  |  107 lines

  1. /* menu.h
  2.  * Datatypes, definitions and functions for creating menu's and menu-item lists
  3.  */
  4.  
  5. #ifndef MENU_H
  6. #define MENU_H
  7.  
  8. #include "OS:territory.h"
  9. #include "OS:wimp.h"
  10.  
  11. typedef struct list_s list_t;
  12.  
  13. typedef struct nlist_s
  14.         {
  15.         char *name;
  16.         void *data;
  17.         list_t *sub;
  18.         struct nlist_s *next;
  19.         } nlist_t;
  20.  
  21. struct list_s
  22.        {
  23.        int n, s, max;
  24.        bool updated;
  25.        nlist_t *first, *last;
  26.        };
  27.  
  28. extern wimp_menu *menu,
  29.                  *provider_m, *provider_h,
  30.                  *country_m, *country_h,
  31.                  *phone_m, *phone_h,
  32.                  *script_m, *script_h,
  33.                  *login_m, *login_h,
  34.                  *modem_m, *modem_h,
  35.                  *stack_m, *stack_h,
  36.                  *driver_m, *driver_h,
  37.                  *baud_m, *baud_h,
  38.                  *delay_m, *delay_h;
  39.  
  40. #define cistrcmp(s1, s2) territory_collate(territory_CURRENT, (s1), (s2), territory_IGNORE_CASE | territory_IGNORE_ACCENT)
  41.  
  42. #define menu_INFO 0
  43. #define menu_QUIT 1
  44.  
  45. #define menu_ADD_WRITE 1
  46. #define menu_TITLE_INDIRECTED 2
  47. #define menu_DONT_TICK 4
  48. #define menu_EXACT_TICK 8
  49.  
  50. /* Auto */
  51. #ifndef MEMCHECK
  52. extern void *xmalloc(size_t s);
  53. #else
  54. #define xmalloc(s) check_alloc(s, __FILE__, __LINE__, 0)
  55. #endif
  56.  
  57. extern char *strdup(const char *s)
  58. ;
  59. extern char *makepath(const char *s, ...)
  60. ;
  61. extern list_t *new_list(void)
  62. ;
  63. extern nlist_t *add_link(list_t *list, const char *s)
  64. /* Add string 's' in new element on linked list 'list'
  65.  * Return pointer to new element
  66.  */
  67. ;
  68. extern list_t *file_list(const char *path, bool recurse)
  69. /* Create and return a linked list of filenames in the given path
  70.  * Recurse into dirs (lists) if recurse
  71.  */
  72. ;
  73. extern wimp_menu *list_menu(const list_t *list, const wimp_menu *header, int h, const char *tickme, int flags)
  74. /* Create a menu from the linked list of strings fiven by list;
  75.  * header points to the title definition and possibly h initialising entries.
  76.  * When 'tickme' is in the list of items, tick it, else (or tickme==NULL) tick first item
  77.  * Returns: NULL when list and header are empty
  78.  *          ptr to menu structure otherwise
  79.  */
  80. ;
  81. extern wimp_menu_entry *ticked(wimp_menu *m)
  82. /* Return pointer to first ticked menu entry
  83.  * or NULL when none are ticked
  84.  */
  85. ;
  86. extern void tickonly(wimp_menu *m, int item)
  87. ;
  88. extern wimp_menu_entry *stickonly(wimp_menu *m, const char *s)
  89. /* Tick entry s and return pointer to ticked menu entry
  90.  */
  91. ;
  92. extern void free_list(list_t *list)
  93. ;
  94. extern nlist_t *list_search(const list_t *list, const char *s)
  95. /* Return pointer to first list elm which contains string 's' in its name field
  96.  */
  97. ;
  98. extern list_t *load_list(const char *s)
  99. ;
  100. extern void save_list(list_t *list, const char *s)
  101. ;
  102. extern void list_del(list_t *list, nlist_t *elm)
  103. ;
  104. extern void shade_entry(wimp_menu *m, int item, bool shade)
  105. ;
  106. #endif
  107.